<template>
	    <view class='p-20'>
			<view>
				<navbar  title="提现记录" :isGoBack="true" :isNotice="true" ></navbar>
			</view>
			<view>
			  <swiper class="tab-content"  duration="300" bindchange="changeTab" :style="{'height':winHeight+'px'}">
					<!-- 全部 -->
					<swiper-item>
						<scroll-view :scroll-y="true" class="new-list-box" @scrolltolower="allLoadMore" scroll-top="scrollTop" scroll-with-animation :refresher-enabled="true" refresher-threshold="80" refresher-default-style="white" refresher-background="white" :refresher-triggered="triggered" @refresherrefresh="onAllRefresh">
							<block v-if="allTabList.length > 0">
								<view class="new-list-item" v-for="(item,index) in allTabList" :key="index">                        
									<view class="item-tag dis-flex-between">                    
										<view class="content-deadline mb-15 text-xsl">交易时间：{{item.add_time}}</view>
										<view class="content-deadline">类型：{{item.status}}</view>                            
									</view>
									<view class="item-tag dis-flex-between">
									  <view class="content-deadline mb-15" style="color: gray;font-weight: bold;font-size: 28rpx;" >{{item.bankname}}</view>
									<view class="content-deadline">提现金额：{{item.money}}</view>
								  </view>
								</view>
							</block>                
						</scroll-view>
					</swiper-item>       
				</swiper>				
			</view>
		</view>
</template>

<script>
	export default {
		data() {
			return {
				cashType:'',
				userInfo:{},
				winHeight:0,
				pageNo:1,
				allTabList:[], // 全部  
				currentTab: 1, // 当前所在滑块的 index
				scrollTop: 0, // 设置竖向滚动条位置
				 triggered: false, // 下拉是否激活
			};
		},
		
		onLoad(options){
			let that=this
			if(options.cashType){
			  this.cashType=options.cashType			  
			}
			let height = uni.getSystemInfoSync().windowHeight;
			this.winHeight = (height - 150);			
			this._requestPageList(true);
		},	
		methods:{
			// 参数
			_requestPageList(isLoadMore = false, callback) {
			  if(!isLoadMore){
				this.allTabList=[]; // 全部       
				this.pageNo= 1;
				
			  }
			  let opt = {
				pageNo :this.pageNo,				
				token:uni.getStorageSync('userInfo').app_openid,
				login_type:'app',
				status:this.currentTab,
				type:this.cashType
			  }    
			  this._requestPageListCom("virtualTaskList", opt, callback);
			},
			// 列表接口
			_requestPageListCom(url, params, callback) {    
			  this.$http.docashLog(params).then(res => {
				if (res.resCode == "9999") {
				  let oldList = [];
				  oldList = this.allTabList;       
				  const newGoodsList = res.data.list
				  const allData = [...oldList, ...newGoodsList]
				  // console.log(allData,'allData')     
				  this.allTabList=allData
				  if(callback && typeof callback === 'function'){
					callback()
				  }
				}
			  })
			},			  
			// 上拉加载  滚动到底部/右边时触发
			allLoadMore(e){
				let _self = this;
				if (this._allLoadMore) return
				this._allLoadMore = true;
				this.pageNo= ++_self.pageNo				
				this._requestPageList(true, () => {
				  _self._allLoadMore = false;
				});
			},
			
			// 下拉刷新接口
			onAllRefresh() {
			 // 开启下拉自定义样式
				this.triggered = true;
                this.pageNo=1;
				this._requestPageList(false, () => {
					// 当处理完数据刷新后，wx.stopPullDownRefresh可以停止当前页面的下拉刷新
					this.triggered = false;
				});    
			}	
		  },
		onShow(){	
		}
	}
</script>

<style>
	@import "./index.css";
</style>